{{- $heading := "See also" }}
{{- $related := site.RegularPages.Related . | first 5 }}

{{- if eq .Type "functions" }}
  {{- $heading = "Related functions" }}
  {{- $opts := dict "document" . "indices" (slice "relatedFunctions") }}
  {{- $related = site.RegularPages.Related $opts | first 7 }}
{{- end }}

{{- with $related }}
  <h2>{{ $heading }}</h2>
  <ul>
    {{- range . }}
      <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
    {{- end }}
  </ul>
{{- end }}
